#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<string.h>
#define filename "log.txt"

int main(){
    fprintf(stdout,"hello normal message\n");
    fprintf(stdout,"hello normal message\n");
    fprintf(stdout,"hello normal message\n");
    fprintf(stdout,"hello normal message\n");
    fprintf(stdout,"hello normal message\n");
   
    
    
    fprintf(stderr,"hello error message\n");
    fprintf(stderr,"hello error message\n");
    fprintf(stderr,"hello error message\n");
    fprintf(stderr,"hello error message\n");
    fprintf(stderr,"hello error message\n");
    return 0;
}

//int main(){
    //close(1);
   // int fd=open(filename,O_TRUNC|O_CREAT|O_WRONLY,0666);
    //int fd=open(filename,O_APPEND|O_CREAT|O_WRONLY,0666);
   // int fd=open(filename,O_RDONLY);
    //if(fd<0){
    //    perror("open");
    //    return 1;
    //}
    //dup2(fd,1);
    // printf("fd:%d\n",fd);
    //printf("hello printf\n");
    //fprintf(stdout,"hello fprintf\n");


   // printf("fd:%d\n",fd);
   //dup2(fd,0);
 //  char buff[1024];
 //  ssize_t ret=read(0,buff,sizeof(buff)-1);
 //  buff[ret]='\0';
 //  printf("echo# %s",buff);
   // dup2(fd,1);
   // close(fd);
   // const char*mesg="hello Linux\n";
   // int cnt=5;
   // while(cnt){
   //     write(1,mesg,strlen(mesg));
   //     cnt--;
   // }
//    close(fd);
//    return 0;
//}
